// map
Array.prototype.myMap = function (callback) {
    let res = []
    for (let index = 0; index < this.length; index++) {
        res.push(callback.call(this, this[index], index, this))
    }
    return res
}
// reduce
Array.prototype.reduce = function (callback, initValue) {
    let val = initValue ? initValue : this[0];
    let acc = val;
    for (let index = 0; index < this.length; index++) {
        acc += callback.call(this, acc, this[index], index, this)
    }
    return acc;
}
// flat
Array.prototype.flat = function (dep) {
    // 外面加一个判断
    let result = []
    if (!dep || dep < 0) return this;

    // 注意 
    arr.forEach(item => {
        if (Array.isArray(item)) {
            let count = dep
            result = result.concat(item.flatFn(count--))
        } else {
            result.push(item)
        }
    })
    return result
}
// isArray
Array.prototype.isArray = function (obj) {
    Object.prototype.toString.call(Object(obj)) === "[Object Array]"
}